Title Banner

Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Graphics /
Chapter 3 - Geometric Styles / About Geometric Styles


Style Attributes

The style attributes property of a style object contains six attributes that affect the drawing of a shape. Four of these attributes affect how QuickDraw GX places the geometric pen relative to the contours of a shape:

These four attributes are discussed in the next section, "Pen Placement."

There are also two style attributes that determine whether the geometric points of a shape are constrained to a grid when the shape is drawn:

These two attributes are discussed in the section "Grids" beginning on page 3-20.

Pen Placement

You can use the center-frame, inside-frame, and outside-frame style attributes to specify where QuickDraw GX should position the pen with respect to the shape's geometry. QuickDraw uses these attributes to position the pen, which also affects the placement of dashes and how dashes are clipped. For some examples, see "Insetting Dashes" beginning on page 3-73 and "Combining Caps, Joins, Dashes, and Patterns" beginning on page 3-91.

Figure 3-9 shows the results of these style attributes. Notice that QuickDraw GX considers contour direction when determining which side of a contour is the inside: the right side of the contour is the inside, while the left side of the contour is the outside.

Figure 3-9 Pen placement[Missing image]

QuickDraw GX also provides the auto-inset style attribute, which allows you to specify that QuickDraw GX should ignore contour direction when determining which side of a contour is the inside. When you set this style attribute, QuickDraw GX determines the true inside of a contour, rather than using the right side as the inside. Figure 3-10 shows the effect of setting the auto-inset style attribute for the shapes depicted in Figure 3-9.

Figure 3-10 Effect of the auto-inset style attribute

When a contour crosses over itself, the results of setting the auto-inset style attribute are unpredictable, as the contour has no true inside (or, actually, has multiple true insides). For the figure-eight shape in Figure 3-11, setting the gxAutoInsetStyle and the gxInsideFrameStyle style attributes could lead to one of two results.

Figure 3-11 Effect of the auto-inset and inside-frame style attributes for a crossed contour

To ensure that setting the auto-inset style attribute behaves as you would expect, you need to call the GXSimplifyShape function, which is described in the chapter "Geometric Operations" in this book. This function redefines the shape's geometry to eliminate crossed contours, as shown in Figure 3-12.

Figure 3-12 Eliminating crossed contours

The section "Manipulating Pen Width and Placement" on page 3-51 gives an example of specifying pen placement. The section "Style Attributes" on page 3-98 defines the style attributes enumeration, and the section "Getting and Setting Style Attributes" on page 3-109 describes the functions you can use to manipulate them.

Grids

From the initial geometry specification to the final image rendering, each QuickDraw GX shape exists in a number of different coordinate spaces. You describe a shape's geometry in geometry space, the style and transform modifications happen in local space, the shape then exists in one or more view ports' global spaces, and the shape is finally rendered in the pixels of a view device's device space.

In each of these coordinate spaces, QuickDraw GX allows fractional coordinate values. When you specify points in a shape's geometry, you are not limited to integer values, such as (1, 1) or (-10, 10). Instead, you can specify that the shape's geometric points fall between integral positions in the geometry space's coordinate grid, for example (0.5, 0.5). During each transformation of the shape from geometry to rendering, QuickDraw GX maintains fractional coordinate values.

The style attributes property of a style object contains two flags that allow you to suppress fractional coordinate values--that is, these flags allow you to constrain a shape's geometric points to integer coordinate values in the different coordinate systems.

The source-grid style attribute indicates that QuickDraw GX should constrain the shape's geometric points to integral positions on the local space grid, before making the style and transform modifications.

The device-grid style attribute indicates that QuickDraw GX should constrain the shape's geometric points to integral positions (that is, pixel positions) on the device space grid, after making style, transform, and view port modifications.

Note
These style attributes only affect a shape while it is being drawn. They do not affect the geometric points you specify in the original shape geometry.
To constrain a shape to integral positions on a coordinate space's grid, QuickDraw GX moves the entire shape (that is, all the shape's geometric points) so that the shape's first geometric point lies on the nearest grid position, and then moves each remaining geometric point to the nearest grid position.

Figure 3-13 depicts the grid-constraining algorithm.

Figure 3-13 Constraining shapes to grids

The sections "Constraining Shape Geometries to Grids" on page 3-40 and "Constraining Shapes to Device Grids" on page 3-42 give examples of the grid-constraining style attributes. The section "Style Attributes" on page 3-98 defines the style attributes enumeration and the section "Getting and Setting Style Attributes" beginning on page 3-109 describes the functions you can use to manipulate them.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996




Navigation graphic, see text links

Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help